﻿using System;

namespace TypeBuilderFx.Core
{
    /// <summary>Represents a factory of dynamic types.</summary>
    /// <typeparam name="T">Type it creates.</typeparam>
    public interface IFactory<T>
        where T : class
    {
        /// <summary>Returns a new instance.</summary>
        /// <returns></returns>
        T Build();
    }

    /// <summary>Represents a factory of dynamic types.</summary>
    /// <typeparam name="T">Type it creates.</typeparam>
    /// <typeparam name="P">Type of the parameter used in the instance creation (constructor parameter).</typeparam>
    public interface IFactory<T, P>
        where T : class
    {
        /// <summary>Returns a new instance.</summary>
        /// <param name="constructorParameter"></param>
        /// <returns></returns>
        T Build(P constructorParameter);
    }

    /// <summary>Represents a factory of dynamic types.</summary>
    /// <typeparam name="T">Type it creates.</typeparam>
    /// <typeparam name="P1">Type of the first parameter used in the instance creation (constructor parameter).</typeparam>
    /// <typeparam name="P2">Type of the second parameter used in the instance creation (constructor parameter).</typeparam>
    public interface IFactory<T, P1, P2>
        where T : class
    {
        /// <summary>Returns a new instance.</summary>
        /// <param name="constructorParameter1"></param>
        /// <param name="constructorParameter2"></param>
        /// <returns></returns>
        T Build(P1 constructorParameter1, P2 constructorParameter2);
	}

	/// <summary>Represents a factory of dynamic types.</summary>
	/// <typeparam name="T">Type it creates.</typeparam>
	/// <typeparam name="P1">Type of the first parameter used in the instance creation (constructor parameter).</typeparam>
	/// <typeparam name="P2">Type of the second parameter used in the instance creation (constructor parameter).</typeparam>
	/// <typeparam name="P3">Type of the third parameter used in the instance creation (constructor parameter).</typeparam>
	public interface IFactory<T, P1, P2, P3>
		where T : class
	{
		/// <summary>Returns a new instance.</summary>
		/// <param name="constructorParameter1"></param>
		/// <param name="constructorParameter2"></param>
		/// <param name="constructorParameter3"></param>
		/// <returns></returns>
		T Build(P1 constructorParameter1, P2 constructorParameter2, P3 constructorParameter3);
	}

	/// <summary>Represents a factory of dynamic types.</summary>
	/// <typeparam name="T">Type it creates.</typeparam>
	/// <typeparam name="P1">Type of the first parameter used in the instance creation (constructor parameter).</typeparam>
	/// <typeparam name="P2">Type of the second parameter used in the instance creation (constructor parameter).</typeparam>
	/// <typeparam name="P3">Type of the third parameter used in the instance creation (constructor parameter).</typeparam>
	/// <typeparam name="P4">Type of the fourth parameter used in the instance creation (constructor parameter).</typeparam>
	public interface IFactory<T, P1, P2, P3, P4>
		where T : class
	{
		/// <summary>Returns a new instance.</summary>
		/// <param name="constructorParameter1"></param>
		/// <param name="constructorParameter2"></param>
		/// <param name="constructorParameter3"></param>
		/// <param name="constructorParameter4"></param>
		/// <returns></returns>
		T Build(P1 constructorParameter1, P2 constructorParameter2, P3 constructorParameter3, P4 constructorParameter4);
	}
}